package leetcode.editor.cn.q1xx

fun findMin(nums: IntArray): Int {
        var l = 0
        var r = nums.size - 1
        while (l < r) {
            val mid = l + (r - l) / 2
            println("$l $r $mid")
            if (nums[mid] < nums[r]) {
                r = mid
            } else {
                l = mid + 1
            }
        }
        return nums[l]
}

fun main() {
    println(leetcode.editor.cn.q1xx.findMin(intArrayOf(3, 1, 2)))
}